//
//  ZYCMessageRevokeView.m
//  ZDSC
//
//  Created by ZDTX on 2021/9/17.
//

#import "ZYCMessageRevokeView.h"
@interface ZYCMessageRevokeView ()

@property (nonatomic,strong)UIView *dimView;
@property (nonatomic, strong) UIButton *closeButton;
@property (nonatomic, strong) UIImageView *iconImageView;
@property (nonatomic, strong) UILabel *titleLabel;

@end
@implementation ZYCMessageRevokeView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.frame = CGRectMake(0, 0, kScreenWidth,  kScreenHeight);
        self.hidden = NO;
        self.dimView.hidden = NO;
        [self.dimView addSubview:self.closeButton];
        [self.dimView addSubview:self.iconImageView];
        [self.dimView addSubview:self.titleLabel];
        
        [self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(17.5, 17.5));
            make.left.equalTo(self.dimView).offset(39.0f);
            make.top.equalTo(self.dimView).offset(50.0f);
        }];
        [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(42.0f, 42.0f));
            make.centerX.equalTo(self.dimView);
            make.top.equalTo(self.closeButton.mas_bottom).offset(72.0f);
        }];
        
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.dimView);
            make.top.equalTo(self.iconImageView.mas_bottom).offset(18.0f);
        }];
    }
    return self;
}
- (UIView *)dimView{
    if (!_dimView) {
        _dimView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width,  [UIScreen mainScreen].bounds.size.height)];
        _dimView.backgroundColor = [UIColor whiteColor];
        [self addSubview:_dimView];
    }
    return _dimView;
}




- (UIButton *)closeButton {
    if (!_closeButton) {
        _closeButton = [[UIButton alloc] init];
        [_closeButton setImage:[UIImage imageNamed:@"close"] forState:UIControlStateNormal];
        [_closeButton addTarget:self action:@selector(clickCloseAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _closeButton;
}

- (void)clickCloseAction:(UIButton *)sender{
    self.hidden = YES;
    if (self.closeBlock) {
        self.closeBlock();
    }
}

- (UIImageView *)iconImageView {
    if (!_iconImageView) {
        _iconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"jth"]];
    }
    return _iconImageView;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [UILabel LabelWithString:@"该内容已被发布者撤回" Font:kCustomFont(@"PingFangSC-Regular", 18.0f) titleColor:HEX_RGB(@"#060606") textAlignment:ZZTextAlignmentCenter];
    }
    return _titleLabel;
}
@end
